Skip to content

enable support for device map auto#180

Merged
shubhamugare merged 3 commits intomainfrom
auto_device
Apr 2, 2025
Merged

enable support for device map auto#180
shubhamugare merged 3 commits intomainfrom
auto_device

Conversation

@tarsur909
Copy link
Collaborator

@tarsur909 tarsur909 commented Apr 2, 2025

Fixes #142

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for automatic device mapping by introducing a new parameter ("use_auto") in various parts of the codebase. Key changes include:

  • Updating the language model initialization to use the model's device.
  • Adding a new "use_auto" parameter to be passed in the inference and model loading routines.
  • Documenting the new "use_auto" option in the README.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
syncode/language_model.py Update device assignment by using self.model.device instead of a passed device.
syncode/infer.py Introduced a new "use_auto" flag in function signatures and method calls to pass through the device mapping setting.
syncode/common.py Extended load_model to support auto device mapping based on the "use_auto" flag.
README.md Documentation update to include the new "use_auto" CLI option.
Comments suppressed due to low confidence (2)

syncode/infer.py:53

  • [nitpick] Consider renaming 'use_auto' to a more descriptive name such as 'use_auto_device_mapping' to clarify its purpose.
use_auto: bool = False,

syncode/common.py:14

  • [nitpick] Consider renaming the parameter 'use_auto' to a more descriptive name (e.g., 'use_auto_device_mapping') to enhance clarity across the codebase.
def load_model(model_name, device, quantize, use_auto = False):

@tarsur909 tarsur909 linked an issue Apr 2, 2025 that may be closed by this pull request
Copy link
Collaborator

@shubhamugare shubhamugare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good! Let me merge it once the tests pass

@shubhamugare shubhamugare merged commit f7d976f into main Apr 2, 2025
1 check passed
@shubhamugare shubhamugare deleted the auto_device branch April 6, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to use device_map="auto" option

2 participants

Comments